package njupt.proxy;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import njupt.dao.GoodsDAO;
import njupt.daoimp.GoodsDAOimp;
import njupt.dbc.DatabaseConnnection;
import njupt.vo.Goods;


public class GoodsDAOProxy implements GoodsDAO{
	DatabaseConnnection dbc =null;
	private GoodsDAO dao;
	Goods goods=new Goods();
	
//构造函数
	public GoodsDAOProxy(){
		try{	
		this.dbc=new DatabaseConnnection();
		}catch(Exception e){
			e.printStackTrace();
		}
		
		if(this.dbc.getConnection()==null){
			System.out.println("error collection!!");
		}
		this.dao=new GoodsDAOimp(this.dbc.getConnection());
	}
	
//selectgoods方法	
	public Map selectgoods(int goodsid) throws Exception {	  
		Map goodsmsg = new HashMap();
		   try{
			   this.dao.selectgoods(goodsid);	
			   return this.dao.selectgoods(goodsid);
		   }catch(Exception e){
			   throw e;
		   } finally{
			  this.dbc.close();
		  }
		 }


	public List<String[]> selectgoodsByType(String goodstype) throws Exception {
		try{
			return this.dao.selectgoodsByType(goodstype);
		}catch(Exception e){
			throw e;   }		
	}

}
